#include <iostream>

using namespace std;

class Solution {
public:
    int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) {
        int64_t max_x = max(A, E);
        int64_t max_y = max(B, F);
        int64_t min_x = min(C, G);
        int64_t min_y = min(D, H);
        max_x = min_x - max_x > 0 ? min_x - max_x : 0;
        max_y = min_y - max_y > 0 ? min_y - max_y : 0;
        return (int) ((int64_t) (C - A) * (D - B) + (int64_t) (G - E) * (H - F) - max_x * max_y);
    }
};

int main() {
    Solution solution;
    int output = solution.computeArea(-2, -2, 2, 2, -1, -1, 1, 1);
    cout << output << endl;
    return 0;
}